#define _CRT_SECURE_NO_WARNINGS 1


#include<set>
#include<vector>
#include<string>
#include<iostream>

using namespace std;

bool Func(string s1, string s2)
{
    int hash1[128] = { 0 }, hash2[128] = { 0 };
    for (auto& e : s1)
    {
        hash1[e]++;
    }
    for (auto& e : s2)
    {
        hash2[e]++;
    }
    for (int i = 0; i < 128; i++)
    {
        if (hash1[i] != hash2[i])
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int n = 0;
    cin >> n;
    vector<string> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    set<int> tree;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (tree.size() == n)
        {
            break;
        }
        if (tree.count(i))
        {
            continue;
        }
        for (int j = 0; j < n; j++)
        {
            if (tree.count(j) || j == i)
            {
                continue;
            }
            if (Func(v[i], v[j]))
            {
                
                tree.insert(j);
            }
        }
        tree.insert(i);
        count++;
    }
    cout << count << endl;

    return 0;
}